package com.xoa.controller.workflow;


import com.xoa.model.workflow.RelationFuncWithBLOBs;
import com.xoa.service.workflow.relationFunc.RelationFuncServiceImpl;
import com.xoa.util.LimsJson;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
/*
工作流设置中关联应用设置模块
 */

@Controller
@RequestMapping("/relationFunc")
public class RelationFuncController {
    @Autowired
    RelationFuncServiceImpl relationFuncfuncService;

    @RequestMapping("/index")
    public String index() {
        return "app/workflow/relationFunc/index";
    }

    //查询所有
    @ResponseBody
    @RequestMapping("/selectAllRalationFunc")
    public LimsJson selectAllRalationFunc(String type, Integer parentId, Integer page, Integer limit) {
        return relationFuncfuncService.selectAllRalationFunc(type,parentId,page,limit);
    }

    //添加
    @ResponseBody
    @RequestMapping("/insertRelationFunc")
    public LimsJson insertRelationFunc(RelationFuncWithBLOBs relationFunc, HttpServletRequest request) {
        return relationFuncfuncService.insertRelationFunc(relationFunc, request);
    }

    //根据id删除信息
    @ResponseBody
    @RequestMapping("/delRelationFunc")
    public LimsJson delRelationFunc(String ids) {
        return relationFuncfuncService.delRelationFunc(ids);
    }

    //根据id查询单条信息
    @ResponseBody
    @RequestMapping("/selRelationFuncById")
    public LimsJson selRelationFuncById(Integer relationId) {
        return relationFuncfuncService.selRelationFuncById(relationId);
    }

    //根据id更新信息
    @ResponseBody
    @RequestMapping("/updateRelationFuncById")
    public LimsJson updateRelationFuncById(RelationFuncWithBLOBs relationFunc, HttpServletRequest request) {
        return relationFuncfuncService.updateRelationFuncById(relationFunc, request);
    }

    //流程设计器 关联应用下拉数据源
    @ResponseBody
    @RequestMapping("/showRelation")
    public ToJson showRelation(Integer formId){
        return relationFuncfuncService.selectRalationFunc(formId);
    }
}


